const Login = r => require.ensure([], () => r(require('./views/Login.vue')), 'Login')
const NotFound = r => require.ensure([], () => r(require('./views/404.vue')), 'NotFound')
const Home = r => require.ensure([], () => r(require('./views/Home.vue')), 'Home')

const kkIndex = r => require.ensure([], () => r(require('./views/kkIndex.vue')), 'kkIndex')
const chartEcharts = r => require.ensure([], () => r(require('./views/data/echarts.vue')), 'chartEcharts')
const userIndex = r => require.ensure([], () => r(require('./views/data/user.vue')), 'userIndex')
const workerIndex = r => require.ensure([], () => r(require('./views/data/worker.vue')), 'workerIndex')
const userAddress = r => require.ensure([], () => r(require('./views/data/address.vue')), 'userAddress')
const orderIndex = r => require.ensure([], () => r(require('./views/data/order.vue')), 'userIndex')
const userFeedback = r => require.ensure([], () => r(require('./views/data/feedback.vue')), 'userFeedback')
const orderTicketBuy = r => require.ensure([], () => r(require('./views/data/ticketBuy.vue')), 'orderTicketBuy')
const fieldOrderIndex = r => require.ensure([], () => r(require('./views/data/fieldbuy.vue')), 'fieldOrderIndex')
const goodsOrderIndex = r => require.ensure([], () => r(require('./views/data/goodsOrder.vue')), 'goodsOrderIndex')

const noticeIndex = r => require.ensure([], () => r(require('./views/ad/notice.vue')), 'noticeIndex')
const bannerIndex = r => require.ensure([], () => r(require('./views/ad/banner.vue')), 'bannerIndex')
const downLineIndex = r => require.ensure([], () => r(require('./views/ad/active.vue')), 'downLineIndex')

const strategyIndex = r => require.ensure([], () => r(require('./views/server/strategy.vue')), 'strategyIndex')
const strategyAdd = r => require.ensure([], () => r(require('./views/server/addStrategy.vue')), 'strategyAdd')
const strategyEdit = r => require.ensure([], () => r(require('./views/server/editStrategy.vue')), 'strategyEdit')
const plantIndex = r => require.ensure([], () => r(require('./views/server/plant.vue')), 'plantIndex')
const plantEdit = r => require.ensure([], () => r(require('./views/server/editPlant.vue')), 'plantEdit')
const newsIndex = r => require.ensure([], () => r(require('./views/server/news.vue')), 'newsIndex')
const newsAdd = r => require.ensure([], () => r(require('./views/server/addNews.vue')), 'newsAdd')
const newsEdit = r => require.ensure([], () => r(require('./views/server/editNews.vue')), 'newsEdit')
const plantAdd = r => require.ensure([], () => r(require('./views/server/addPlant.vue')), 'plantAdd')

const dailyIndex = r => require.ensure([], () => r(require('./views/operation/daily.vue')), 'dailyIndex')
const mapIndex = r => require.ensure([], () => r(require('./views/operation/map.vue')), 'mapIndex')
const readyPlantIndex = r => require.ensure([], () => r(require('./views/operation/readyPlant.vue')), 'readyPlantIndex')
const fieldIndex = r => require.ensure([], () => r(require('./views/operation/field.vue')), 'fieldIndex')
const plantLogIndex = r => require.ensure([], () => r(require('./views/operation/plantLog.vue')), 'plantLogIndex')
const taskIndex = r => require.ensure([], () => r(require('./views/operation/taskPool.vue')), 'taskIndex')
const dayphotoIndex = r => require.ensure([], () => r(require('./views/operation/dayphoto.vue')), 'dayphotoIndex')
const collectIndex = r => require.ensure([], () => r(require('./views/operation/collect.vue')), 'collectIndex')
const buyerIndex = r => require.ensure([], () => r(require('./views/operation/buyer.vue')), 'buyerIndex')
const erpIndex = r => require.ensure([], () => r(require('./views/operation/erp.vue')), 'erpIndex')

const couponsAdd = r => require.ensure([], () => r(require('./views/coupons/add.vue')), 'couponsAdd')
const couponsIndex = r => require.ensure([], () => r(require('./views/coupons/index.vue')), 'couponsIndex')
const cdKeyIndex = r => require.ensure([], () => r(require('./views/coupons/cdKey.vue')), 'cdKeyIndex')
const couponsCouponsPkg = r => require.ensure([], () => r(require('./views/coupons/couponsPkg.vue')), 'couponsCouponsPkg')

const ticketIndex = r => require.ensure([], () => r(require('./views/ticket/index.vue')), 'ticketIndex')
const ticketTicket = r => require.ensure([], () => r(require('./views/ticket/ticket.vue')), 'ticketTicket')
const ticketAdd = r => require.ensure([], () => r(require('./views/ticket/addTicket.vue')), 'ticketAdd')
const ticketLimit = r => require.ensure([], () => r(require('./views/ticket/daynum.vue')), 'ticketLimit')
const ticketEdit = r => require.ensure([], () => r(require('./views/ticket/editTicket.vue')), 'ticketEdit')

const userMomentIndex = r => require.ensure([], () => r(require('./views/moment/userMoment.vue')), 'userMomentIndex')
const momentCommentIndex = r => require.ensure([], () => r(require('./views/moment/comment.vue')), 'momentCommentIndex')

const cameraIndex = r => require.ensure([], () => r(require('./views/tools/camera.vue')), 'cameraIndex')
const miaoshaIndex = r => require.ensure([], () => r(require('./views/tools/miaosha.vue')), 'miaoshaIndex')
const testIndex = r => require.ensure([], () => r(require('./views/tools/test.vue')), 'testIndex')
const firstOrderIndex = r => require.ensure([], () => r(require('./views/tools/firstOrder.vue')), 'firstOrderIndex')

const downloadIndex = r => require.ensure([], () => r(require('./views/download.vue')), 'downloadIndex')
const adminerIndex = r => require.ensure([], () => r(require('./views/adminer.vue')), 'adminerIndex')

const goodsIndex = r => require.ensure([], () => r(require('./views/goods/goods.vue')), 'goodsIndex')
const goodsAdd = r => require.ensure([], () => r(require('./views/goods/addGoods.vue')), 'goodsAdd')

const goodsEdit = r => require.ensure([], () => r(require('./views/goods/editGoods.vue')), 'goodsEdit')
const goodsCateIndex = r => require.ensure([], () => r(require('./views/goods/category.vue')), 'goodsCateIndex')
// 虚拟卡
const cardIndex = r => require.ensure([], () => r(require('./views/card/card.vue')), 'cardIndex')
const cardsAdd = r => require.ensure([], () => r(require('./views/card/addCards.vue')), 'cardsAdd')
const cardsEdit = r => require.ensure([], () => r(require('./views/card/editCards.vue')), 'cardsEdit')
const cardsOrder = r => require.ensure([], () => r(require('./views/data/cardsOrder.vue')), 'cardsOrder')
// 虚拟卡地址
const cardsAddress = r => require.ensure([], () => r(require('./views/server/cardsAddress.vue')), 'cardsAddress')
let routes = [
  {
    path: '/login',
    component: Login,
    name: '',
    hidden: true
  },
  {
    path: '/home',
    component: Home,
    hidden: true,
    children: [
      {path: '/404', component: NotFound}
    ]
  },
  {
    path: '/home',
    component: Home,
    hidden: true,
    children: [
      {path: '/kkIndex', component: kkIndex}
    ]
  },
  {
    path: '/home',
    component: Home,
    title: '数据中心',
    iconCls: 'fa fa-line-chart', // 图标样式class
    children: [
      {path: '/chart/echarts', component: chartEcharts, name: '数据概览', A: 'chart/echarts'},
      {path: '/user/index', component: userIndex, name: '用户数据', A: 'user/index'},
      {path: '/worker/index', component: workerIndex, name: '工人信息', A: 'worker/index'},
      {path: '/user/address', component: userAddress, name: '用户地址', A: 'user/address'},
      {path: '/order/index', component: orderIndex, name: '支付日志', A: 'order/index'},
      {path: '/user/feedback', component: userFeedback, name: '用户反馈', A: 'user/feedback'},
      {path: '/order/ticketBuy', component: orderTicketBuy, name: '门票订单', A: 'order/ticketBuy'},
      {path: '/fieldOrder/index', component: fieldOrderIndex, name: '购地订单', A: 'fieldOrder/index'},
      {path: '/goodsOrder/index', component: goodsOrderIndex, name: '商品订单', A: 'goodsOrder/index'},
      {path: '/cardsOrder/index', component: cardsOrder, name: '虚拟卡订单', A: 'cardsOrder/index'}
    ],
    item: 'information'
  },
  {
    path: '/home',
    component: Home,
    title: '广告投放',
    iconCls: 'fa fa-id-card-o',
    children: [
      {path: '/notice/index', component: noticeIndex, name: '发布消息', A: 'notice/index'},
      {path: '/banner/index', component: bannerIndex, name: 'banner管理', A: 'banner/index'},
      {path: '/downLine/index', component: downLineIndex, name: '首页活动', A: 'downLine/index'}
    ],
    item: 'ad'
  },
  {
    path: '/home',
    component: Home,
    title: '产品服务',
    iconCls: 'el-icon-menu',
    children: [
      {path: '/strategy/index', component: strategyIndex, name: '攻略管理', A: 'strategy/index'},
      {path: '/strategy/add', component: strategyAdd, name: '攻略新增', A: 'strategy/add', hidden: true},
      {path: '/strategy/edit/id/:id', component: strategyEdit, name: '攻略修改', A: 'strategy/edit', hidden: true},
      {path: '/plant/index', component: plantIndex, name: '种子管理', A: 'plant/index'},
      {path: '/plant/add', component: plantAdd, name: '添加种子', A: 'plant/add'},
      {path: '/plant/edit/name/:name', component: plantEdit, name: '编辑种子', A: 'plant/edit', hidden: true},
      {path: '/news/index', component: newsIndex, name: '新闻资讯', A: 'news/index'},
      {path: '/news/add', component: newsAdd, name: '资讯新增', A: 'news/add', hidden: true},
      {path: '/news/edit/id/:id', component: newsEdit, name: '资讯修改', A: 'news/edit', hidden: true},
      {path: '/goods/index', component: goodsIndex, name: '商品管理', A: 'goods/index'},
      {path: '/goods/add', component: goodsAdd, name: '商品添加', A: 'goods/add', hidden: true},
      {path: '/goods/edit/id/:id', component: goodsEdit, name: '商品编辑', A: 'goods/edit', hidden: true},
      {path: '/goodsCate/index', component: goodsCateIndex, name: '商品品类', A: 'goodsCate/index'},
      {path: '/cards/index', component: cardIndex, name: '虚拟卡管理', A: 'cards/index'},
      {path: '/cards/add', component: cardsAdd, name: '虚拟卡添加', A: 'cards/add', hidden: true},
      {path: '/cards/edit/id/:id', component: cardsEdit, name: '虚拟卡编辑', A: 'cards/edit', hidden: true},
      {path: '/cardsAddress/index', component: cardsAddress, name:'卡片收获地址', A:'cardsAddress/index'}
    ],
    item: 'product'
  },
  {
    path: '/home',
    component: Home,
    title: '运营中心',
    iconCls: 'fa fa-circle-thin',
    children: [
      {path: '/daily/index', component: dailyIndex, name: '用户日常', A: 'daily/index'},
      {path: '/map/index', component: mapIndex, name: '土地管理', A: 'map/index'},
      {path: '/readyPlant/index', component: readyPlantIndex, name: '预种植系统', A: 'readyPlant/index'},
      {path: '/field/index', component: fieldIndex, name: '菜品管理', A: 'field/index'},
      {path: '/plantLog/index', component: plantLogIndex, name: '种植记录', A: 'plantLog/index'},
      {path: '/task/index', component: taskIndex, name: '任务分配', A: 'task/index'},
      {path: '/dayphoto/index', component: dayphotoIndex, name: '每日一拍', A: 'dayphoto/index'},
      {path: '/collect/index', component: collectIndex, name: '收菜管理', A: 'collect/index'},
      {path: '/buyer/index', component: buyerIndex, name: '购买记录', A: 'buyer/index'},
      {path: '/erp/index', component: erpIndex, name: 'erp系统', A: 'erp/index'}
    ],
    item: 'operation'
  },
  {
    path: '/home',
    component: Home,
    title: '优惠券',
    iconCls: 'fa el-icon-date',
    children: [
      {path: '/coupons/add', component: couponsAdd, name: '添加优惠券', A: 'coupons/add'},
      {path: '/coupons/index', component: couponsIndex, name: '优惠券列表', A: 'coupons/index'},
      {path: '/cdKey/index', component: cdKeyIndex, name: '激活码', A: 'cdKey/index'},
      {path: '/coupons/couponsPkg', component: couponsCouponsPkg, name: '优惠卷包', A: 'coupons/couponsPkg'}
    ],
    item: 'coupons'
  },
  {
    path: '/home',
    component: Home,
    title: '门票系统',
    iconCls: 'fa fa-ticket',
    children: [
      {path: '/ticket/index', component: ticketIndex, name: '顶部信息', A: 'ticket/index'},
      {path: '/ticket/ticket', component: ticketTicket, name: '门票信息', A: 'ticket/ticket'},
      {path: '/ticket/add', component: ticketAdd, name: '添加门票', A: 'ticket/add', hidden: true},
      {path: '/ticket/limit', component: ticketLimit, name: '门票数量', A: 'ticket/limit'},
      {path: '/ticket/edit/id/:id', component: ticketEdit, name: '编辑门票', A: 'ticket/edit', hidden: true}
    ],
    item: 'ticket'
  },
  {
    path: '/home',
    component: Home,
    title: '地主圈',
    iconCls: 'fa fa-comment-o',
    children: [
      {path: '/userMoment/index', component: userMomentIndex, name: '用户圈圈', A: 'userMoment/index'},
      {path: '/momentComment/index', component: momentCommentIndex, name: '圈圈评论', A: 'momentComment/index'}
    ],
    item: 'farm_moment'
  },
  {
    path: '/home',
    component: Home,
    title: '工具栏',
    iconCls: 'fa fa-wrench',
    children: [
      {path: '/camera/index', component: cameraIndex, name: '关闭摄像', A: 'camera/index'},
      {path: '/miaosha/index', component: miaoshaIndex, name: '秒杀工具', A: 'miaosha/index'},
      {path: '/test/index', component: testIndex, name: '生成sn', A: 'test/index'},
      {path: '/firstOrder/index', component: firstOrderIndex, name: '首单活动', A: 'firstOrder/index'},
    ],
    item: 'tools'
  },
  {
    path: '/home',
    component: Home,
    title: '数据下载',
    iconCls: 'fa fa-cloud-download',
    leaf: true, // 只有一个节点
    children: [
      {path: '/download/index', component: downloadIndex, name: '数据下载', A: 'download/index'}
    ],
    item: 'download'
  },
  {
    path: '/home',
    component: Home,
    title: '管理员',
    iconCls: 'fa fa-address-card',
    leaf: true, // 只有一个节点
    children: [
      {path: '/adminer/index', component: adminerIndex, name: '管理员', A: 'adminer/index'}
    ],
    item: 'adminer'
  },
  {
    path: '*',
    redirect: { path: '/kkIndex' },
    hidden: true
  }
]

export default routes
